<div style="height:20px"></div>
<div class="container">
	<div class="row">
					<div class="col-md-12" id="wrap-left">
                    
                    <div class="view_breadcrumb" >
                    	<ul class="breadcrumb view_bread">
                        	<li><a href="<?php echo HOME; ?>"><i class="icon-home"></i> Home</a></li>
                            <li><a href="<?php echo url_category($data['category']['id'],$data['category']['alias']); ?>"><?php echo $data['category']['name']; ?></a></li>
                          
                        </ul>
                    
                    </div>
                    <div class="leftDetail">
						<div class="detail_view_image">
                        <div class="head_info">
                                  <h1><?php echo $data['post']['title'] ?></h1>
                                    <ul class="list-inline moreinfo" id="detail_top_info">
                                  			  <li><i class="icon-eye-open"></i> <?php echo $data['post']['views'] ?> Views</li>
                                                <li class="view_time"><i class="icon-time"></i> <?php echo time_ago($data['post']['date_created']); ?></li>
                                             
                                            </ul>
        
                                  <div class="clearfix"></div>
                          </div>
                         
                         
                         
                         

						  <input type="hidden" name="index_post_id" id="index_post_id" value="<?= $_GET['id'] ?>" />
								
						
				 					<div class="clearfix"></div>
									
                                    
									<p id="detail_description" style="margin-left:10px">
									
										<?php
										if($data['post']['type'] != 'text'){ 
											echo $data['post']['description']; 
											}else{
											echo nl2br($data['post']['sdes']); 
											}
										?>
										
									</p>
							
								<div id="detail_main_content" style="margin-top: 0px; padding-left:10px">
							
                            <?php if($data['post']['type']=='video'){ 
									  echo $data['post']['embed'];
							 }
							 ?>
                             
                             <?php if($data['post']['type']=='image'){ 
							 		  echo $data['post']['images_big'];
									
							 }?>
                             
								<?php if($data['post']['type']=='text'){ 
										echo $data['post']['description'];
							 }?>
                                </div>
					
							
							<div class="clr"></div>
						
                             
						</div><!-- end .detail view image -->
				
                
                
                	<div style="height:20px"></div>
                    
                    
                    

                        
                        
                            <ul class="mobipager">
  <li class="controlNavLoading" style="height:30px; display: none;"><img style="padding-top: 5px;" width="20" src="public/images/loading.gif" alt="loading" /></li>
  <li class="pull-left"><a class="detail_controlNavItem" id="preNav">&larr; Bài Trước</a></li>
  <li  class="pull-right"><a  class="detail_controlNavItem" id="nextNav">Bài Sau &rarr;</a></li>
</ul>
<style>
.mobipager a{ cursor:pointer; font-weight:bold}
</style>
                        
                        
                        <div style="height:20px"></div>
                        <!-- Kho do -->
                        
                        <div class="khodo row">
                 
                        <div class="col-md-6 col-xs-12" style="font-family: 'Noticia Text', Times, serif;font-size: 1em;">
                        <B>Theo bạn, Tình Huống này đỡ được không ? </B>
                        <Br/>
                                 <div class="btn-group">
	                                  <a href="" data-href='<?php echo $data['post']['pid'] ?>' data-rel='up' title="Khó đỡ thật" class="btnThumb btn btn-success detail_thumbup" >                 
	                                  	<i class="icon-thumbs-up icon-stack-base"></i>
	                                  </a> 
	    
	                                  <a href="" data-href='<?php echo $data['post']['pid'] ?>' data-rel='down' title="Đỡ phát một " class="btnThumb btn btn-danger detail_thumbdown" >                 
	                                  	<i class="icon-thumbs-down icon-stack-base"></i>
	                                  </a> 
                                 </div>
                                    
                                 <b class="detail_thumbup_view"><span class="append_vote_num_up_<?php echo $data['post']['pid'] ?>"  data-href='<?php echo $data['post']['pid'] ?>' data-rel='up' style="color:#2ecc71; font-size:22px"><?php echo $data['post']['kd_up'] ?></span></B> không đỡ nổi <i class="icon-thumbs-up icon-stack-base" style="color:#2ecc71; font-size:22px"></i>, 
                                 <b class="detail_thumbdown_view"><span class="append_vote_num_down_<?php echo $data['post']['pid'] ?>" data-href='<?php echo $data['post']['pid'] ?>' data-rel='down' style="color:#e74c3c; font-size:22px"><?php echo $data['post']['kd_down'] ?></span></b> đỡ phát một <i class="icon-thumbs-down icon-stack-base" style="color:#e74c3c; font-size:22px"></i>
                        </div>
                        
                        
                           	<div class="col-md-6 col-xs-12" style="border-left:1px solid #fff;font-family: 'Noticia Text', Times, serif;font-size: 1em;">
                    Like  <b style="color:#e74c3c">KHÓ ĐỠ CHẤM INFO</b> trên facebook <i class="icon-thumbs-up"></i> <br/>
                    
                         
                      <div class="fb-like-box" data-href=" https://www.facebook.com/24hmanga" data-width="180" data-height="70" data-show-faces="false" data-stream="false" data-header="false"></div>  
                    	</div>
                    </div> <!-- End of Khodo -->
                        <!-- End of kho-do -->
                        
                          <div style="height:20px"></div>
						<div id="fb-comment-box" class="facebook-comment col-md-12"><div class="fb-comments" data-href="<?= HOME . 'post/' . url_encode_post($data['post']['pid']) ?>"></div></div>
					
                    </div> <!-- End of leftDetail-->		
					</div><!-- end .col-md-9  -->
                    
                    
                   
                    </div><!-- End of row -->
                    </div> <!-- End of container -->
							
					<script type="text/javascript">
						$(document).ready(function(){
							$('.clickShowView').click(function(e){
								e.preventDefault();
								$('.innerRightBlock').hide();
								
								task = $(this).attr('id');
								if($('#show_' + task).html().length){
									$('#show_' + task).fadeIn('normal');
								}else{
									$('#show_' + task).show();
									$('#show_' + task).append('<div id="rightShowLoading" class="loading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
									$('#rightShowLoading').show();
									
									//$('#loading').show();
									$.ajax({
										url: '<?= BASE_URL ?>index.php?module=ajax&act=ajax&' + task + '=1',
										type : 'POST',
										success: function(data){
											if(data){
												$('#show_' + task).append(data).hide().fadeIn('slow');
												$('#rightShowLoading').remove();
											}else{
												$('#show_' + task).append('Đang cập nhật dữ liệu.');
												$('#rightShowLoading').remove();
											}
											
										}
									});
								}
							});

						

							clicked = false;
							
							$('.detail_controlNavItem').live('click',function(e){
								
								
								$('#wrap-left').css('opacity', '0.5');
								$('.controlNavLoading').css('display', 'inline');
								e.preventDefault();
								
								nextOrPrev = $(this).attr('id');
								
								var iid = $('#index_post_id').val();
								if(clicked == false){
									clicked = true;
									$.ajax({
	
										url: '<?= BASE_URL; ?>index.php?module=ajax&act=ajax&detail_ajax_get_post=1&nav=' + nextOrPrev,
										type: 'POST',
										data: {id: iid},
										success: function(data){
											console.log(data);
											
											newData = JSON.parse(data);
											console.log(newData);
											
											
											if(newData.post){
												
												if(newData.post.error_max_page == true){
													popupMessage('Thông báo', <?= json_encode(array('Bạn đã xem hết bài viết. Quay lại trang chủ để xem bài mới nhất nhé!')); ?>, 'alert-info');
													$('#wrap-left').css('opacity', '1');
													$('.controlNavLoading').css('display', 'none');
													return;
													
												}

												if(newData.post.error_min_page == true){
													
													popupMessage('Thông báo', <?= json_encode(array('Bạn đang xem bài viết mới nhất rồi!')); ?>, 'alert-info');
													$('#wrap-left').css('opacity', '1');
													$('.controlNavLoading').css('display', 'none');
													return;
												}
												
												var userDetail = '';
												$('#index_post_id').val(newData.post.pid);
												$('.head_info h1').html(newData.post.title);
												
												
												$('.facebook-comment').html('<div class="fb-comments" data-href="<?= HOME . 'post/' ?>'+newData.post.pid+'"></div>');
												
												$('#detail_top_info').html(' <li>'+newData.post.views+' Views</li><li class="view_time">'+newData.post.date_created+'</li>');
												if(newData.post.detail_description != '' || newData.post.detail_description != null){
														$('#detail_description').html(newData.post.detail_description);
													}

												$('.detail_thumbup').attr('data-href', newData.post.blank_pid);
												$('.detail_thumbdown').attr('data-href', newData.post.blank_pid);
												$('.detail_thumbup_view').html('<span class="append_vote_num_up_'+newData.post.blank_pid+'" data-href="'+newData.post.blank_pid+'" data-rel="up" style="color:#2ecc71; font-size:22px">'+newData.post.kd_up+'</span>');
												$('.detail_thumbdown_view').html('<span class="append_vote_num_down_'+newData.post.blank_pid+'" data-href="'+newData.post.blank_pid+'" data-rel="down" style="color:#e74c3c; font-size:22px">'+newData.post.kd_down+'</span>');
												
												$('#detail_main_content').html(newData.post.detail_main_content);
												$('.detail_view_user > .col-md-2').html('<img src="' + newData.post.user.avatar + '" alt="' + newData.post.username + '" class="img-responsive img-circle" />');
												userDetail += '<h4><a href="' + newData.post.user.link + '">' + newData.post.user.username + '</a></h4>';
												userDetail += '<p>' + newData.post.user.gioithieu + '</p>';
												userDetail += '<ul class="list-inline moreinfo" id="detail_bottom_info">'
												userDetail += '<li>' + newData.post.user.likes +' Likes</li>';
												userDetail += '<li>' + newData.post.user.views +' Views</li>';
												userDetail += '<li>' + newData.post.user.comments +' Comments</li>';
												userDetail += '<li>' + newData.post.user.post +' Posts</li>';
												userDetail += '<li>' + newData.post.user.album +' Albums</li>';
												userDetail += '</ul>';
												
												if(newData.post.user.facebook == 1){
													userDetail += '<span class="pull-left">';
													userDetail += '<a href="https://www.facebook.com/'+ newData.post.user.facebook_id +'>"><i class="icon-facebook"></i> Vist My Facebook</a>';
													userDetail += '</span>';
												}
												userDetail += '<span class="pull-right" style="color:#d35400">';
												userDetail += '<i class="icon-email"></i> ' + newData.post.user.email;
												userDetail += '</span><div class="clearfix"></div>';
	
												$('.detail_view_user > .col-md-10').html(userDetail);
												$('#wrap-left').css('opacity', '1');
												$('.controlNavLoading').css('display','none');
												FB.XFBML.parse(document.getElementById('leftDetail'));
												
											}
										},
									});
									clicked = false;
								}
							});

						});

					</script>	

					
				
                 